<?php
/**
 * 	Bushido
 *
 * @category   Bushido
 * @package    Bushido_Ldap
 * @copyright  Copyright (c) 2008-2009 Nathan Keyes
 * @author Nathan Keyes
 * @version    $Id: Ldap.php 7 2009-11-14 22:42:08Z nkeyes $
 */

require_once('Zend/Ldap.php');

/**
 * 	Bushido
 *
 * @category   Bushido
 * @package    Bushido
 * @copyright  Copyright (c) 2008-2009 Nathan Keyes

 */
class Bushido_Ldap extends Zend_Ldap
{
	/**
	 * 
	 * @return void
	 * @param array $options Options used in connecting, binding, etc. [optional]
	 */
	public function __construct(array $options = array())
	{
		$options['accountFilterFormat'] = isset($options['accountFilterFormat']) ? $options['accountFilterFormat'] : 'uid=%s';
		parent::__construct($options);
	}
    
    public function search($filter, $basedn = null, $scope = self::SEARCH_SCOPE_SUB, array $attributes = array(), $sort = null, $collectionClass = null)
	{
		if (!is_resource($this->_resource))
		{
			$this->bind();
		}
		return parent::search($filter, $basedn, $scope, $attributes, $sort, $collectionClass);
    }
	
}